<template>
  <div>
    <DoctorHeader titleText="窗口收费"></DoctorHeader>
    <el-divider />
    <h3>患者信息查询</h3>
    <div class="wy-filter">
      <el-input placeholder="请输入病历号" v-model="query.caseNumber" @keydown="search"></el-input>
    </div>
    <el-divider />
    <h3>患者信息确认</h3>
    <el-form style="margin: 20px 0" inline label-width="80px">
      <el-form-item label="患者姓名">{{result.register.realName}}</el-form-item>
      <el-form-item label="身份证号">{{result.register.cardNumber}}</el-form-item>
      <el-form-item label="年龄">{{result.register.age}}</el-form-item>
      <el-form-item label="性别">{{result.register.gender}}</el-form-item>
    </el-form>
    <CheckTable :tableData="result.tableData" />
    <InspectionTable style="margin-top: 20px" :tableData="result.inspectiontable" />
    <DrugTable style="margin-top: 20px" :tableData="drugTable" />
  </div>
</template>

<script setup>
import DoctorHeader from '@/components/doctor/header'
import { reactive, ref } from 'vue'
import { get, post } from '@/util/axios'
import {ElMessage} from 'element-plus'
import CheckTable from './checkTable'
import DrugTable from './drugTable'
import InspectionTable from "@/views/caiwu/pay/inspectionTable.vue";
const query = reactive({
  caseNumber: '',
  checkState: '已开立'
})
const result = reactive({
  register: {},
  tableData: [],
  inspectiontable: []
})
const sum = ref(0)
const drugTable = ref([])
const wytable = ref()
function search (event) {
  if (event.keyCode === 13) {
    getTableData()
  }
}
function getTableData () {
  get('/checkRequest/list', query, content => {
    result.register = content.register
    result.tableData = content.checkRequestList
  })
  get('/inspectionRequest/list', query, content => {
    result.register = content.register
    result.inspectiontable=content.inspectionRequestList
    console.log(content.inspectionRequestList[0])
  })
  get('/prescription/jiaofei', query, content => {
    drugTable.value=content
  })
}
function selectionChange(newSelection) {
  sum.value = 0
  for (const i in newSelection) {
    sum.value += newSelection[i].medicalTechnology.techPrice
  }
}
</script>

<style scoped lang="scss">
.wy-filter {
  margin-top: 20px;
}
</style>
